package com.authine.cloudpivot.ext.service.trade;

import com.authine.cloudpivot.ext.dto.base.PageList;
import com.authine.cloudpivot.ext.dto.model.trade.Trade;
import com.authine.cloudpivot.ext.dto.query.TradeQuery;
import com.authine.mvp.app.launcher.domain.utills.ApplicationContextUtils;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;

import java.util.List;

public interface TradeService {
    NamedParameterJdbcTemplate jdbcTemplate =  ApplicationContextUtils.getBean(NamedParameterJdbcTemplate.class);

    Trade loadById(String id);

    List<Trade> loadListByIds(List<String> ids);

    PageList<Trade> listTradeByParam(TradeQuery query);

    /**
     * 回写交易记录的可申请发票数量和发票状态
     * @param tradeIds 交易记录ID
     */
    void writeBackAllowedInvoiceQuantity(List<String> tradeIds);

    /**
     * 订单对应交易方向的结算状态
     * @param orderGoodsId
     * @param direction
     * @return
     */
    boolean isRepayment(String orderGoodsId, String direction);
}
